
@{
    ViewData["Title"] = "床位管理";
}
    <style>
        /* 全局样式重置 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', Arial, sans-serif;
            background-color: #f5f5f5;
            color: #333;
            line-height: 1.6;
            margin: 0;
            padding: 0;
        }

        /* 页面标题 */
        .page-header {
            background-color: #f39c12;
            color: white;
            padding: 12px 20px;
            margin-bottom: 0;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            position: relative;
        }

        .page-title {
            font-size: 20px;
            font-weight: bold;
        }

        .page-container {
            padding: 20px;
            background-color: #fff;
            min-height: calc(100vh - 50px);
            max-width: 1200px;
            margin: 0 auto;
        }

        /* 床位信息修改区域 */
        .bed-info-section {
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            padding: 20px;
            margin-bottom: 20px;
        }

        .section-title {
            font-size: 16px;
            font-weight: bold;
            color: #333;
            margin-bottom: 15px;
            padding-left: 5px;
        }

        .form-row {
            display: flex;
            gap: 20px;
            margin-bottom: 15px;
            align-items: center;
            flex-wrap: wrap;
        }

        .form-group {
            display: flex;
            align-items: center;
            gap: 8px;
        }

            .form-group label {
                font-size: 14px;
                color: #666;
                font-weight: normal;
                min-width: 70px;
            }

            .form-group input,
            .form-group select {
                padding: 6px 10px;
                border: 1px solid #ddd;
                border-radius: 3px;
                font-size: 14px;
                transition: border-color 0.3s ease;
                width: 150px;
                background-color: white;
            }

                .form-group input:focus,
                .form-group select:focus {
                    outline: none;
                    border-color: #f39c12;
                }

        .btn {
            padding: 6px 15px;
            border: none;
            border-radius: 3px;
            font-size: 14px;
            font-weight: normal;
            cursor: pointer;
            transition: all 0.3s ease;
            margin-right: 10px;
        }

        .btn-danger {
            background-color: #dd4b39;
            color: white;
        }

            .btn-danger:hover {
                background-color: #d73925;
            }

        .btn-primary {
            background-color: #3c8dbc;
            color: white;
            margin-left: 10px;
        }

            .btn-primary:hover {
                background-color: #367fa9;
            }

        .modify-btn {
            color: #f39c12;
            font-weight: normal;
            cursor: pointer;
            text-decoration: none;
            font-size: 14px;
        }

            .modify-btn:hover {
                color: #e67e22;
                text-decoration: underline;
            }

        /* 床位展示区域 */
        .beds-container {
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            padding: 20px;
        }

        .beds-grid {
            display: flex;
            flex-wrap: wrap;
            gap: 30px;
            margin-top: 30px;
        }

        .bed-row {
            display: flex;
            gap: 40px;
            margin-bottom: 40px;
        }

        .bed-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .bed-icon {
            width: 60px;
            height: 40px;
            border: 2px solid #3c8dbc;
            border-radius: 4px;
            background-color: white;
            position: relative;
            margin-bottom: 5px;
            transition: all 0.3s ease;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        }

            /* 床的形状装饰 */
            .bed-icon::before {
                content: '';
                position: absolute;
                left: 5px;
                right: 5px;
                top: 8px;
                height: 4px;
                background-color: #e0e0e0;
                border-radius: 2px;
            }

            .bed-icon::after {
                content: '';
                position: absolute;
                left: 10px;
                right: 10px;
                top: 16px;
                height: 2px;
                background-color: #e0e0e0;
                border-radius: 1px;
            }

            .bed-icon.selected {
                border-color: #f39c12;
                background-color: #fff3cd;
            }

                .bed-icon.selected::before,
                .bed-icon.selected::after {
                    background-color: #f39c12;
                }

        .bed-number {
            font-size: 14px;
            color: #666;
            margin-top: 8px;
            font-weight: 500;
        }

        /* 响应式设计 */
        @* 转义的媒体查询 *@
        @@media (max-width: 768px) {
            .form-row {
                flex-direction: column;
                align-items: stretch;
                gap: 15px;
            }

            .form-group {
                flex-direction: column;
                align-items: stretch;
            }

                .form-group label {
                    margin-bottom: 5px;
                }

            .beds-grid {
                display: grid;
                grid-template-columns: repeat(4, 1fr);
            }
        }</style>

    <div class="page-container">
        <!-- 床位信息修改区域 -->
        <div class="bed-info-section">
            <div class="section-title">床位信息修改</div>

            <div style="border: 1px solid #ddd; padding: 20px; border-radius: 4px;">
                <div class="form-row">
                    <div class="form-group">
                        <label for="bedLocation">床位地址:</label>
                        <input type="text" id="bedLocation" placeholder="">
                    </div>

                    <div class="form-group">
                        <label for="nurse">责任护士:</label>
                        <select id="nurse">
                            <option value="">请选择</option>
                            <option value="1">王护士</option>
                            <option value="2">李护士</option>
                            <option value="3">张护士</option>
                        </select>
                    </div>

                    <div class="form-group">
                        <label for="bedNumber">床号:</label>
                        <select id="bedNumber">
                            <option value="">请选择</option>
                        </select>
                    </div>

                    <div class="form-group">
                        <span class="modify-btn" onclick="showModifyOptions()">修改即为换床</span>
                    </div>
                </div>

                <div class="form-row">
                    <div class="form-group">
                        <label for="bedInfo">床位信息:</label>
                        <input type="text" id="bedInfo" placeholder="">
                    </div>
                </div>

                <div class="form-row" style="margin-top: 20px;">
                    <button class="btn btn-danger" onclick="deleteBed()">删除</button>
                    <button class="btn btn-primary" onclick="saveBedInfo()">保存</button>
                </div>
            </div>
        </div>

        <!-- 床位展示区域 -->
        <div class="beds-container">
            <div class="section-title">床位分布</div>

            <div class="beds-grid">
                <!-- 第一行床位 -->
                <div class="bed-row">
                    <div class="bed-item" onclick="selectBed(1)">
                        <div class="bed-icon selected"></div>
                        <div class="bed-number">01</div>
                    </div>

                    <div class="bed-item" onclick="selectBed(2)">
                        <div class="bed-icon"></div>
                        <div class="bed-number">02</div>
                    </div>

                    <div class="bed-item" onclick="selectBed(3)">
                        <div class="bed-icon"></div>
                        <div class="bed-number">03</div>
                    </div>

                    <div class="bed-item" onclick="selectBed(5)">
                        <div class="bed-icon"></div>
                        <div class="bed-number">05</div>
                    </div>

                    <div class="bed-item" onclick="selectBed(6)">
                        <div class="bed-icon"></div>
                        <div class="bed-number">06</div>
                    </div>

                    <div class="bed-item" onclick="selectBed(7)">
                        <div class="bed-icon"></div>
                        <div class="bed-number">07</div>
                    </div>

                    <div class="bed-item" onclick="selectBed(8)">
                        <div class="bed-icon"></div>
                        <div class="bed-number">08</div>
                    </div>

                    <div class="bed-item" onclick="selectBed(9)">
                        <div class="bed-icon"></div>
                        <div class="bed-number">09</div>
                    </div>
                </div>

                <!-- 第二行床位 -->
                <div class="bed-row">
                    <div class="bed-item" onclick="selectBed(10)">
                        <div class="bed-icon"></div>
                        <div class="bed-number">10</div>
                    </div>

                    <div class="bed-item" onclick="selectBed(11)">
                        <div class="bed-icon"></div>
                        <div class="bed-number">11</div>
                    </div>

                    <div class="bed-item" onclick="selectBed(12)">
                        <div class="bed-icon"></div>
                        <div class="bed-number">12</div>
                    </div>

                    <div class="bed-item" onclick="selectBed(13)">
                        <div class="bed-icon"></div>
                        <div class="bed-number">13</div>
                    </div>

                    <div class="bed-item" onclick="selectBed(15)">
                        <div class="bed-icon"></div>
                        <div class="bed-number">15</div>
                    </div>

                    <div class="bed-item" onclick="selectBed(16)">
                        <div class="bed-icon"></div>
                        <div class="bed-number">16</div>
                    </div>

                    <div class="bed-item" onclick="selectBed(17)">
                        <div class="bed-icon"></div>
                        <div class="bed-number">17</div>
                    </div>

                    <div class="bed-item" onclick="selectBed(18)">
                        <div class="bed-icon"></div>
                        <div class="bed-number">18</div>
                    </div>
                </div>

                <!-- 第三行床位 -->
                <div class="bed-row">
                    <div class="bed-item" onclick="selectBed(19)">
                        <div class="bed-icon"></div>
                        <div class="bed-number">19</div>
                    </div>

                    <div class="bed-item" onclick="selectBed(20)">
                        <div class="bed-icon"></div>
                        <div class="bed-number">20</div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        function selectBed(bedNumber) {
            // 移除之前选中的床位样式
            const selectedBeds = document.querySelectorAll('.bed-icon.selected');
            selectedBeds.forEach(bed => bed.classList.remove('selected'));

            // 添加当前选中床位的样式
            const bedItems = document.querySelectorAll('.bed-item');
            bedItems.forEach(item => {
                if (item.querySelector('.bed-number').textContent === bedNumber.toString().padStart(2, '0')) {
                    item.querySelector('.bed-icon').classList.add('selected');
                }
            });

            // 更新表单中的床号
            const bedNumberSelect = document.getElementById('bedNumber');
            // 清空现有选项
            bedNumberSelect.innerHTML = '';
            // 添加选中的床号选项
            const option = document.createElement('option');
            option.value = bedNumber;
            option.textContent = bedNumber.toString().padStart(2, '0');
            option.selected = true;
            bedNumberSelect.appendChild(option);

            // 模拟填充床位地址和其他信息
            document.getElementById('bedLocation').value = `ICU病房-${bedNumber}号床`;
            document.getElementById('bedInfo').value = `标准床位-${bedNumber}`;
        }

        function showModifyOptions() {
            alert('修改即为换床操作');
        }

        function deleteBed() {
            if (confirm('确定要删除当前选中的床位吗？')) {
                alert('删除成功');
            }
        }

        function saveBedInfo() {
            alert('保存成功');
        }

        // 页面加载时默认选中01号床位
        document.addEventListener('DOMContentLoaded', function() {
            selectBed(1);
        });
    </script>
    <div class="mt-4" style="text-align: center;">
        <a class="btn btn-link" href="@Url.Action("Index", "Patients")">返回</a>
    </div>





